www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\Label\custom_Label\公用函数include及论坛博客等标签库\nd_include_auto_pagination.asp
<%'$start_ext_newDsoft 以下系统生成,勿删! '$newDsoft_label_type$:asp_label$end_newDsoft_label_type$ '$newDsoft_label_name$:include_pagination$end_newDsoft_label_name$ '$newDsoft_label_sql$: $end_newDsoft_label_sql$ '$newDsoft_label_params$:$end_newDsoft_label_params$ '$newDsoft_label_fenye_num$: $end_newDsoft_label_fenye_num$ '$newDsoft_label_beizhu$:包含进自动分页和手动分页的function$end_newDsoft_label_beizhu$ '$newDsoft_is_sys_label$:0$end_newDsoft_is_sys_label$ '$newDsoft_other_params$: $end_newDsoft_other_params$ '$end_ext_newDsoft%> <% '================================================= '过程名:autoxpagexit(is_auto,contentxss,MaxCharPerPage_when_auto) '作 用:采用自动分页或手动分页方式显示具体的内容 '参 数:is_auto ----- 是否自动分 ' contentxss ----- 需要处理的内容 ' StrContent ----- 需要处理的内容 'qq:657697290,http://www.aspcpu.com,柏拉图的程序,新动软万能网站管理系统 '================================================= nd_spli_strs="[page_fenye]" '手动分页标志 cuuurrtpppstr="ndarticlepage" '页码的request变量名 strUrl="" strUrltempheiheihei="" function autoxpagexit(is_auto,contentxss) on error resume next '如果自动分页,每页显示多少字 MaxCharPerPage_when_auto=1700 if is_auto=1 then call AutoPagination(MaxCharPerPage_when_auto,contentxss) else call sd_pagexit(contentxss) end if end function '获取自身文件名 aryxx =split(Request.ServerVariables("SCRIPT_NAME"),"/") fileNamexx = aryxx(ubound(aryxx)) strfilename=fileNamexx sfilename=strfilename if instr(1,sfilename,"?",1)<>0 then sfilename=left(sfilename,instr(1,sfilename,"?",1)-1) else sfilename=sfilename end if strUrl=JoinCharzz(sfilename) Fy_Url1=Request.ServerVariables("QUERY_STRING") Fy_a1=split(Fy_Url1,"&") for Fy_x1=0 to ubound(Fy_a1) if instr(Fy_a1(Fy_x1),"=")=len(Fy_a1(Fy_x1)) then Fy_v ="" else Fy_v = mid(Fy_a1(Fy_x1),instr(Fy_a1(Fy_x1),"=")+1,len(Fy_a1(Fy_x1))) end if Fy_Cs_name= left(Fy_a1(Fy_x1),instr(Fy_a1(Fy_x1),"=")-1) if lcase(trim(Fy_Cs_name))<>lcase(cuuurrtpppstr) then strUrl=JoinCharzz(strUrl) strUrl=strUrl&Fy_Cs_name&"="&Fy_v end if Next strUrl=JoinCharzz(strUrl) strUrltempheiheihei=strUrl function JoinCharzz(strUrl) if strUrl="" then JoinCharzz="" exit function end if if InStr(strUrl,"?")<len(strUrl) then if InStr(strUrl,"?")>1 then if InStr(strUrl,"&")<len(strUrl) then JoinCharzz=strUrl & "&" else JoinCharzz=strUrl end if else JoinCharzz=strUrl & "?" end if else JoinCharzz=strUrl end if end function sub AutoPagination(MaxCharPerPage,StrContent) 'dim CurrentPage 'dim ContentLen,MaxPerPage,pages,i,lngBound ' dim BeginPoint,EndPoint ContentLen=len(strContent) CurrentPage=trim(request(cuuurrtpppstr)) if ContentLen<=MaxCharPerPage then response.write strContent else if CurrentPage="" then CurrentPage=1 else CurrentPage=Cint(CurrentPage) end if pages=ContentLen\MaxCharPerPage if MaxCharPerPage*pages<ContentLen then pages=pages+1 end if lngBound=ContentLen '最大误差范围 if CurrentPage<1 then CurrentPage=1 if CurrentPage>pages then CurrentPage=pages dim lngTemp dim lngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1,lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3 dim lngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2 dim lngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2 dim lngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2 dim lngTemp5,lngTemp5_1,lngTemp5_2 dim lngTemp6,lngTemp6_1,lngTemp6_2 if CurrentPage=1 then BeginPoint=1 else BeginPoint=MaxCharPerPage*(CurrentPage-1)+1 lngTemp1_1_1=instr(BeginPoint,strContent,"</table>",1) lngTemp1_1_2=instr(BeginPoint,strContent,"</TABLE>",1) lngTemp1_1_3=instr(BeginPoint,strContent,"</Table>",1) if lngTemp1_1_1>0 then lngTemp1_1=lngTemp1_1_1 elseif lngTemp1_1_2>0 then lngTemp1_1=lngTemp1_1_2 elseif lngTemp1_1_3>0 then lngTemp1_1=lngTemp1_1_3 else lngTemp1_1=0 end if lngTemp1_2_1=instr(BeginPoint,strContent,"<table",1) lngTemp1_2_2=instr(BeginPoint,strContent,"<TABLE",1) lngTemp1_2_3=instr(BeginPoint,strContent,"<Table",1) if lngTemp1_2_1>0 then lngTemp1_2=lngTemp1_2_1 elseif lngTemp1_2_2>0 then lngTemp1_2=lngTemp1_2_2 elseif lngTemp1_2_3>0 then lngTemp1_2=lngTemp1_2_3 else lngTemp1_2=0 end if if lngTemp1_1=0 and lngTemp1_2=0 then lngTemp1=BeginPoint else if lngTemp1_1>lngTemp1_2 then lngtemp1=lngTemp1_2 else lngTemp1=lngTemp1_1+8 end if end if lngTemp2_1_1=instr(BeginPoint,strContent,"</p>",1) lngTemp2_1_2=instr(BeginPoint,strContent,"</P>",1) if lngTemp2_1_1>0 then lngTemp2_1=lngTemp2_1_1 elseif lngTemp2_1_2>0 then lngTemp2_1=lngTemp2_1_2 else lngTemp2_1=0 end if lngTemp2_2_1=instr(BeginPoint,strContent,"<p",1) lngTemp2_2_2=instr(BeginPoint,strContent,"<P",1) if lngTemp2_2_1>0 then lngTemp2_2=lngTemp2_2_1 elseif lngTemp2_2_2>0 then lngTemp2_2=lngTemp2_2_2 else lngTemp2_2=0 end if if lngTemp2_1=0 and lngTemp2_2=0 then lngTemp2=BeginPoint else if lngTemp2_1>lngTemp2_2 then lngtemp2=lngTemp2_2 else lngTemp2=lngTemp2_1+4 end if end if lngTemp3_1_1=instr(BeginPoint,strContent,"</ur>",1) lngTemp3_1_2=instr(BeginPoint,strContent,"</UR>",1) if lngTemp3_1_1>0 then lngTemp3_1=lngTemp3_1_1 elseif lngTemp3_1_2>0 then lngTemp3_1=lngTemp3_1_2 else lngTemp3_1=0 end if lngTemp3_2_1=instr(BeginPoint,strContent,"<ur",1) lngTemp3_2_2=instr(BeginPoint,strContent,"<UR",1) if lngTemp3_2_1>0 then lngTemp3_2=lngTemp3_2_1 elseif lngTemp3_2_2>0 then lngTemp3_2=lngTemp3_2_2 else lngTemp3_2=0 end if if lngTemp3_1=0 and lngTemp3_2=0 then lngTemp3=BeginPoint else if lngTemp3_1>lngTemp3_2 then lngtemp3=lngTemp3_2 else lngTemp3=lngTemp3_1+5 end if end if if lngTemp1<lngTemp2 then lngTemp=lngTemp2 else lngTemp=lngTemp1 end if if lngTemp<lngTemp3 then lngTemp=lngTemp3 end if if lngTemp>BeginPoint and lngTemp<=BeginPoint+lngBound then BeginPoint=lngTemp else lngTemp4_1_1=instr(BeginPoint,strContent,"</li>",1) lngTemp4_1_2=instr(BeginPoint,strContent,"</LI>",1) if lngTemp4_1_1>0 then lngTemp4_1=lngTemp4_1_1 elseif lngTemp4_1_2>0 then lngTemp4_1=lngTemp4_1_2 else lngTemp4_1=0 end if lngTemp4_2_1=instr(BeginPoint,strContent,"<li",1) lngTemp4_2_1=instr(BeginPoint,strContent,"<LI",1) if lngTemp4_2_1>0 then lngTemp4_2=lngTemp4_2_1 elseif lngTemp4_2_2>0 then lngTemp4_2=lngTemp4_2_2 else lngTemp4_2=0 end if if lngTemp4_1=0 and lngTemp4_2=0 then lngTemp4=BeginPoint else if lngTemp4_1>lngTemp4_2 then lngtemp4=lngTemp4_2 else lngTemp4=lngTemp4_1+5 end if end if if lngTemp4>BeginPoint and lngTemp4<=BeginPoint+lngBound then BeginPoint=lngTemp4 else lngTemp5_1=instr(BeginPoint,strContent,"<img",1) lngTemp5_2=instr(BeginPoint,strContent,"<IMG",1) if lngTemp5_1>0 then lngTemp5=lngTemp5_1 elseif lngTemp5_2>0 then lngTemp5=lngTemp5_2 else lngTemp5=BeginPoint end if if lngTemp5>BeginPoint and lngTemp5<BeginPoint+lngBound then BeginPoint=lngTemp5 else lngTemp6_1=instr(BeginPoint,strContent,"<br/>",1) lngTemp6_2=instr(BeginPoint,strContent,"<BR>",1) if lngTemp6_1>0 then lngTemp6=lngTemp6_1 elseif lngTemp6_2>0 then lngTemp6=lngTemp6_2 else lngTemp6=0 end if if lngTemp6>BeginPoint and lngTemp6<BeginPoint+lngBound then BeginPoint=lngTemp6+4 end if end if end if end if end if if CurrentPage=pages then EndPoint=ContentLen else EndPoint=MaxCharPerPage*CurrentPage if EndPoint>=ContentLen then EndPoint=ContentLen else lngTemp1_1_1=instr(EndPoint,strContent,"</table>",1) lngTemp1_1_2=instr(EndPoint,strContent,"</TABLE>",1) lngTemp1_1_3=instr(EndPoint,strContent,"</Table>",1) if lngTemp1_1_1>0 then lngTemp1_1=lngTemp1_1_1 elseif lngTemp1_1_2>0 then lngTemp1_1=lngTemp1_1_2 elseif lngTemp1_1_3>0 then lngTemp1_1=lngTemp1_1_3 else lngTemp1_1=0 end if lngTemp1_2_1=instr(EndPoint,strContent,"<table",1) lngTemp1_2_2=instr(EndPoint,strContent,"<TABLE",1) lngTemp1_2_3=instr(EndPoint,strContent,"<Table",1) if lngTemp1_2_1>0 then lngTemp1_2=lngTemp1_2_1 elseif lngTemp1_2_2>0 then lngTemp1_2=lngTemp1_2_2 elseif lngTemp1_2_3>0 then lngTemp1_2=lngTemp1_2_3 else lngTemp1_2=0 end if if lngTemp1_1=0 and lngTemp1_2=0 then lngTemp1=EndPoint else if lngTemp1_1>lngTemp1_2 then lngtemp1=lngTemp1_2-1 else lngTemp1=lngTemp1_1+7 end if end if lngTemp2_1_1=instr(EndPoint,strContent,"</p>",1) lngTemp2_1_2=instr(EndPoint,strContent,"</P>",1) if lngTemp2_1_1>0 then lngTemp2_1=lngTemp2_1_1 elseif lngTemp2_1_2>0 then lngTemp2_1=lngTemp2_1_2 else lngTemp2_1=0 end if lngTemp2_2_1=instr(EndPoint,strContent,"<p",1) lngTemp2_2_2=instr(EndPoint,strContent,"<P",1) if lngTemp2_2_1>0 then lngTemp2_2=lngTemp2_2_1 elseif lngTemp2_2_2>0 then lngTemp2_2=lngTemp2_2_2 else lngTemp2_2=0 end if if lngTemp2_1=0 and lngTemp2_2=0 then lngTemp2=EndPoint else if lngTemp2_1>lngTemp2_2 then lngTemp2=lngTemp2_2-1 else lngTemp2=lngTemp2_1+3 end if end if lngTemp3_1_1=instr(EndPoint,strContent,"</ur>",1) lngTemp3_1_2=instr(EndPoint,strContent,"</UR>",1) if lngTemp3_1_1>0 then lngTemp3_1=lngTemp3_1_1 elseif lngTemp3_1_2>0 then lngTemp3_1=lngTemp3_1_2 else lngTemp3_1=0 end if lngTemp3_2_1=instr(EndPoint,strContent,"<ur",1) lngTemp3_2_2=instr(EndPoint,strContent,"<UR",1) if lngTemp3_2_1>0 then lngTemp3_2=lngTemp3_2_1 elseif lngTemp3_2_2>0 then lngTemp3_2=lngTemp3_2_2 else lngTemp3_2=0 end if if lngTemp3_1=0 and lngTemp3_2=0 then lngTemp3=EndPoint else if lngTemp3_1>lngTemp3_2 then lngtemp3=lngTemp3_2-1 else lngTemp3=lngTemp3_1+4 end if end if if lngTemp1<lngTemp2 then lngTemp=lngTemp2 else lngTemp=lngTemp1 end if if lngTemp<lngTemp3 then lngTemp=lngTemp3 end if if lngTemp>EndPoint and lngTemp<=EndPoint+lngBound then EndPoint=lngTemp else lngTemp4_1_1=instr(EndPoint,strContent,"</li>",1) lngTemp4_1_2=instr(EndPoint,strContent,"</LI>",1) if lngTemp4_1_1>0 then lngTemp4_1=lngTemp4_1_1 elseif lngTemp4_1_2>0 then lngTemp4_1=lngTemp4_1_2 else lngTemp4_1=0 end if lngTemp4_2_1=instr(EndPoint,strContent,"<li",1) lngTemp4_2_1=instr(EndPoint,strContent,"<LI",1) if lngTemp4_2_1>0 then lngTemp4_2=lngTemp4_2_1 elseif lngTemp4_2_2>0 then lngTemp4_2=lngTemp4_2_2 else lngTemp4_2=0 end if if lngTemp4_1=0 and lngTemp4_2=0 then lngTemp4=EndPoint else if lngTemp4_1>lngTemp4_2 then lngtemp4=lngTemp4_2-1 else lngTemp4=lngTemp4_1+4 end if end if if lngTemp4>EndPoint and lngTemp4<=EndPoint+lngBound then EndPoint=lngTemp4 else lngTemp5_1=instr(EndPoint,strContent,"<img",1) lngTemp5_2=instr(EndPoint,strContent,"<IMG",1) if lngTemp5_1>0 then lngTemp5=lngTemp5_1-1 elseif lngTemp5_2>0 then lngTemp5=lngTemp5_2-1 else lngTemp5=EndPoint end if if lngTemp5>EndPoint and lngTemp5<EndPoint+lngBound then EndPoint=lngTemp5 else lngTemp6_1=instr(EndPoint,strContent,"<br/>",1) lngTemp6_2=instr(EndPoint,strContent,"<BR>",1) if lngTemp6_1>0 then lngTemp6=lngTemp6_1+3 elseif lngTemp6_2>0 then lngTemp6=lngTemp6_2+3 else lngTemp6=EndPoint end if if lngTemp6>EndPoint and lngTemp6<EndPoint+lngBound then EndPoint=lngTemp6 end if end if end if end if end if end if response.write mid(strContent,BeginPoint,EndPoint-BeginPoint) response.write "</p><p align='center'><b>" if CurrentPage>1 then response.write "<a href='" & strUrltempheiheihei & cuuurrtpppstr& "=" & CurrentPage-1 & "'>上一页</a> " end if for i=1 to pages if i=CurrentPage then response.write "<font color='red'>[" & cstr(i) & "]</font> " else response.write "<a href='" & strUrltempheiheihei& cuuurrtpppstr& "=" & i & "'>[" & i & "]</a> " end if next if CurrentPage<pages then response.write " <a href='" &strUrltempheiheihei& cuuurrtpppstr& "=" & CurrentPage+1 & "'>下一页</a>" end if response.write "</b></p>" end if end sub sub sd_pagexit(contentxss) on error resume next contentxss=replace(contentxss,nd_spli_strs,lcase(nd_spli_strs),1,-1,1) '把contentxss中的所有[page_fenye]转为小写 if instr(1,contentxss,nd_spli_strs,1)=0 then response.write contentxss else linenumxx=split(contentxss,nd_spli_strs) '本例为计算字符串[page_fenye]标记的个数 allline=ubound(linenumxx)+1 '全文[page_fenye](换行标记)总数 pagecountxx=int(allline) '计算总页数 pagexx=request(cuuurrtpppstr) if isempty(pagexx) then thispage=1 else thispage=cint(pagexx) end if if thispage>pagecountxx then thispage=pagecountxx response.write linenumxx(thispage-1) '输出分页后的内容 response.write "<br>" response.write "<p align='center'>总共"&pagecountxx&"页 " for i=1 to pagecountxx if thispage=i then response.write "<第"&i&"页> " else response.write "<a href='"&strUrltempheiheihei& cuuurrtpppstr& "="&i&"'>[第"&i&"页]</a> " '输出所有分页链接 end if next end if end sub %>